/*************************************************************
 * File: GroupServiceImpl.java
 * Copyright (c) 2012
 * Author: Huang Shaobin
 * Email: Shaobin.Software@gmail.com Shaobin_Software@163.com 
 * Date: Feb 14, 2013
 * Description: 
 ************************************************************/

package snow.biz.system.service.impl;

import java.util.Arrays;

import snow.biz.base.service.impl.HibernateBaseServiceImpl;
import snow.biz.system.model.Group;
import snow.biz.system.service.IGroupService;
import snow.core.enums.Status;
import snow.core.persistence.query.AndedConditions;
import snow.core.persistence.query.BinaryOperator;
import snow.core.persistence.query.Condition;
import snow.core.persistence.query.Conditions;
import snow.core.persistence.query.Order;

/**
 * 集团相关服务的接口实现
 * 
 * @author Shaobin.Software@gmail.com Shaobin_Software@163.com
 * @version 1.0
 */
public class GroupServiceImpl extends HibernateBaseServiceImpl implements IGroupService {

	public Group searchGroupFrom(String code) {
		Conditions conditions = new AndedConditions();
		conditions.addCondition(new Condition("code", BinaryOperator.EQ, code));
		conditions.addCondition(new Condition("status", BinaryOperator.EQ, Status.SUCCESS));
		return super.findForUnique(conditions, Arrays.asList(new Order[] { Order.desc("id") }), Group.class);
	}

}
